#! /bin/sh

# Bash script to package up files for submitting to FreeDFM
# at http://www.freedrm.com 
# This file looks to the freedfm2lay.lst file to see what files to 
# include in the ZIP archive. The files names are based on the 
# settings used in the CAM processor in Eagel.

CLEAN=1

# Let us know we are running 
echo "Running script for submitting ZIP file to FreeDFM."

# Make sure an output file name is specified
if [ -z "$1" ]; then
	echo "Usage: Specify a name for the ZIP archive"
	echo "  Example: freedfm Archive"
	exit
fi

# Make sure a Readme.txt file exists.
# Bail if we don't have one.
if [ -e Readme.txt ]; then

	echo "--- Creating $1.ZIP archive ---"
	zip -rv $1 . -i@$02lay.lst

	# The folder is typically a mess after the CAM processor.
	# This just cleans up all the files.
	if [ $CLEAN = 1 ]; then
		echo "Cleaing up CAM files"
		rm -v copp_*
		rm -v drill.*
		rm -v mask_*
		rm -v outline.*
		rm -v silk_*
	fi
else
	echo "Usage: Readme.txt file does not exist"
	exit
fi

exit 0
